package com.trkj.service.lzs;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.trkj.dao.lzs.RecruitplanDao;
import com.trkj.pojo.Recruitapply;
import com.trkj.pojo.Recruitplan;

@Service
public class RecruitplanService {
	@Autowired
	private  RecruitplanDao RecruitplanDao;
	   //查询所有
		public  List<Recruitplan>  Recruitplanfall(){
		   return (List<Recruitplan>) RecruitplanDao.findAll();
		}
		
		/*public void tj(Recruitplan ab) {
	
		

		
		RecruitplanDao.save(ab);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	*/

		
		//添加
		public void tj(Timestamp recplanAcenddate  , Timestamp recplanActualdate,BigDecimal recplanActualmoney, String recplanDescribe, BigDecimal recplanEstimate,
				String recplanMode, String recplanModescribe,Timestamp recplanPenddate,String recplanPerson,String recplanPlace,Timestamp recplanPstartdate) {
			try {
				Recruitplan ab= new Recruitplan();
				ab.setRecplanAcenddate(recplanAcenddate);
				ab.setRecplanActualdate(recplanActualdate);
				ab.setRecplanActualmoney(recplanActualmoney);
				ab.setRecplanDescribe(recplanDescribe);
				ab.setRecplanEstimate(recplanEstimate);
				ab.setRecplanModescribe(recplanModescribe);
				ab.setRecplanMode(recplanMode);
				ab.setRecplanModescribe(recplanModescribe);
				ab.setRecplanPenddate(recplanPenddate);
				ab.setRecplanPstartdate(recplanPstartdate);
	            ab.setRecplanPerson(recplanPerson);
				ab.setRecplanPlace(recplanPlace);
				RecruitplanDao.save(ab);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}
		 //编辑  
	     public   void lzs_Edit( long recplanId,Timestamp recplanAcenddate  , Timestamp recplanActualdate,BigDecimal recplanActualmoney, String recplanDescribe, BigDecimal recplanEstimate,
					String recplanMode, String recplanModescribe,Timestamp recplanPenddate,String recplanPerson,String recplanPlace,Timestamp recplanPstartdate) {
	    	
	    	 Recruitplan edit =RecruitplanDao.findOne(recplanId);
	    	 edit.setRecplanAcenddate(recplanAcenddate);
	    	 edit.setRecplanActualdate(recplanActualdate);
	    	 edit.setRecplanActualmoney(recplanActualmoney);
	    	 edit.setRecplanDescribe(recplanDescribe);
	    	 edit.setRecplanEstimate(recplanEstimate);
	    	 edit.setRecplanModescribe(recplanModescribe);
	    	 edit.setRecplanMode(recplanMode);
	    	 edit.setRecplanModescribe(recplanModescribe);
	    	 edit.setRecplanPenddate(recplanPenddate);
	    	 edit.setRecplanPstartdate(recplanPstartdate);
	    	 edit.setRecplanPerson(recplanPerson);
	    	 edit.setRecplanPlace(recplanPlace);
				RecruitplanDao.save(edit);
	     }
	     
	     public Recruitplan chunen(Long recplanId) {
	    	 return RecruitplanDao.findOne(recplanId);
	 		
	     }
	     //模糊查询
		 	public  List<Recruitplan> queryByName (String  text){

	  			return RecruitplanDao.queryByName("%" + text + "%");
	  		}
}
